﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="database.DAO, golf.Character"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>캐릭터 선택</title>

<SCRIPT LANGUAGE="JavaScript">
<!--
	function go_URL(url)
	{
        location.href = url;
	}
//-->
</SCRIPT>

</head>

<%
	DAO dao = DAO.getInstance();
	String accountID = (String)session.getAttribute("accountID");
	int serverNo = (Integer)session.getAttribute("serverNo");
	Character[] characters = dao.getCharacterList(accountID, serverNo);
	
%>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<h1>캐릭터 선택</h1>
<form name="form1" method="post" action="../post/postSelectCharacter.jsp">
<%if(characters != null){ %>
    <table cellspacing="0" width="80%" border="1" bordercolordark="white" bordercolorlight="black">
        <tr>
            <td width="100"><span style="font-size:9pt;">캐릭터이름</span></td>
            <td width="50"><span style="font-size:9pt;">경험치</span></td>
            <td width="50"><span style="font-size:9pt;">엔지</span></td>
            <td width="30"><span style="font-size:9pt;">레벨</span></td>
            <td width="30"><span style="font-size:9pt;">피로도</span></td>
            <td width="30"><span style="font-size:9pt;">파워</span></td>
            <td width="30"><span style="font-size:9pt;">임팩트</span></td>
            <td width="30"><span style="font-size:9pt;">기술</span></td>
            <td width="30"><span style="font-size:9pt;">체력</span></td>
            <td width="30"><span style="font-size:9pt;">평균타수</span></td>
            <td width="30"><span style="font-size:9pt;">평균퍼팅수</span></td>
            <td width="30"><span style="font-size:9pt;">최근평균핸디캡</span></td>
            <td width="30"><span style="font-size:9pt;">홀인원횟수</span></td>
            <td width="30"><span style="font-size:9pt;">최고비거리</span></td>
            <td width="100"><span style="font-size:9pt;">캐릭터등급이름</span></td>
            <td width="100"><span style="font-size:9pt;">모델이름</span></td>
            <td width="100"><span style="font-size:9pt;">승급시험여부</span></td>
            
        </tr>
      <%
      for(int i = 0; i < characters.length; i++ ){
      %>	
        <tr>
        	<td width="100"><span style="font-size:9pt;"><%=characters[i].getName() %></span></td>
            <td width="50"><span style="font-size:9pt;"><%=characters[i].getExp() %></span></td>
            <td width="50"><span style="font-size:9pt;"><%=characters[i].getEnzi() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getLevel() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getTired() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getProperty().getPower() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getProperty().getImpact() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getProperty().getTechnique() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getProperty().getStamina() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getAvg_stroke_no() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getAvg_putting_no() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getRecent_avg_hand() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getHoleinone_cnt() %></span></td>
            <td width="15"><span style="font-size:9pt;"><%=characters[i].getHigh_distance() %></span></td>
            <td width="100"><span style="font-size:9pt;"><%=characters[i].getGrade().getName() %></span></td>
            <td width="100"><span style="font-size:9pt;"><%=characters[i].getModel().getName() %></span></td>
            <td width="100"><span style="font-size:9pt;"><%=characters[i].getPassTest() %></span></td>
        </tr>
      <%}%>
        

    </table>

    <p><span style="font-size:9pt;"><select name="selectChar" size="1">
    <%for(int i = 0; i < characters.length; i++ ){ %>
        <option value="<%=characters[i].getNo() %>"><%=characters[i].getName() %></option>
    <%} %>
	</select><input type="submit" name="action" value="캐릭터 선택"></span></p>
<%}
  else{
	  out.println("보유한 캐릭터가 없습니다. 캐릭터를 생성해주세요.");
  }%>
  <input type="button" value="캐릭터 관리" onclick='go_URL("manageCharacter.jsp"); return false;'>
  
</form>
</body>

</html>